<?php
	class homepage extends CI_Controller {
		
		function __construct()
		{
			parent::__construct();
			$this->load->model('mmg_user');
			$this->load->model('mmg_menu');
			$this->load->model('mmg_image');
			$this->load->model('mset_menu');
		}
		
		public function index()
		{
			$id_menu = "1";
			$data['get_content'] = $this->mmg_menu->contentList($id_menu);
			
			$data['logo_content'] = $this->mmg_image->logoList();
			$data['slide_content'] = $this->mmg_image->slideList();
			
			$data['nav_content'] = $this->mset_menu->navList();
			$data['sub_nav_content'] = $this->mset_menu->subNavList();
			$data['user_online'] = $this->mmg_user->getList();
			
			$this->load->view('web/index',$data);
		}
		
		public function content($id_menu){
			//create captcha
			$vals = array(
				'img_path'   => './upload/captcha/',
				'img_url'    => base_url().'upload/captcha/',
				'img_width'  => '200',
				'img_height' => 30,
				'border' => 0,
				'expiration' => 7200
			);
			$cap = create_captcha($vals);
			$data['image'] = $cap['image'];
			$this->session->set_userdata('mycaptcha', $cap['word']);
			
			$data['get_content'] = $this->mmg_menu->contentList($id_menu);
			
			$data['logo_content'] = $this->mmg_image->logoList();
			$data['slide_content'] = $this->mmg_image->slideList();
			$data['galeri_content'] = $this->mmg_image->galeryList();
			
			$data['nav_content'] = $this->mset_menu->navList();
			$data['sub_nav_content'] = $this->mset_menu->subNavList();
			$data['user_online'] = $this->mmg_user->getList();
			
			$this->load->view('web/index',$data);
		}
	}
?>